/**
 * 导入创建路由对象需要使用的函数
 */
import {createRouter, createWebHashHistory} from "vue-router"

// 导入.vue组件
import Home from '../components/Home.vue'
import List from '../components/List.vue'
import Add from '../components/Add.vue'
import Update from '../components/Update.vue'
import PathParam from '../components/pathParam.vue'
import KeyValueParam from '../components/keyValueParam.vue'

// 创建一个路由对象
const router = createRouter({
    // history属性用于记录路由的历史
    history:createWebHashHistory(),
    // 用于定义多个不同的路径和组件之间的对应关系
    routes:[
        {
            // :id :language 都是路径参数
            path:"/pathParam/:id/:language",
            component:PathParam
        },
        {
            path:"/keyValueParam",
            component:KeyValueParam
        },
        {
            path:"/",
            component:Home
        },
        {
            path:"/home",
            component:Home
        },
        {
            path:"/list",
            component:List
        },
        {
            path:"/add",
            component:Add
        },
        {
            path:"/update",
            component:Update
        },
    ]
})

// 向外暴露router
export default router